package org.linlinjava.litemall.admin.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.util.UrlPathHelper;

/**
 * Admin API Web MVC配置
 * 主要用于处理路径变量中包含斜杠的情况
 */
@Configuration
public class AdminWebMvcConfiguration implements WebMvcConfigurer {
    
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        UrlPathHelper urlPathHelper = new UrlPathHelper();
        // 允许路径变量中包含斜杠，并启用URL解码
        urlPathHelper.setUrlDecode(true);
        urlPathHelper.setRemoveSemicolonContent(false);
        configurer.setUrlPathHelper(urlPathHelper);
    }
}